# 异常

try:
    num = int(input("请输入一个整数:"))
    print(num)
except:
    print("请输入正确的整数")

print("-" * 50)

try:

    num = int(input("请输入一个整数:"))
    result = 8 / num
except ZeroDivisionError:
    print("/0错误")

print("-" * 50)

# 未知错误捕获
try:

    num = int(input("请输入一个整数:"))
    result = 8 / num
except Exception as result:
    print("未知错误%s" % result)
else:
    print("没有捕获异常走这里")
finally:
    print(
        "这里一定会走的"
    )

# 主动抛异常
ex = Exception("密码长度不够")
raise ex

print("-" * 50)
